import { UserService } from '../../shared/services/user.service';
import { Body, Controller, Get, Post, Redirect, Render, RequestMapping } from '@nestjs/common';
import { CreateUserDto } from '../../shared/dtos/user.dto';
@Controller('admin/users')
export class UserController {

  constructor(private readonly userService: UserService) {

  }
  @Render("user/user-list")
  @Get('')
  async findAll() {
    const users = this.userService.findAll();
    return {users}
  }

  @Get("create")
  @Render("user/user-form")
  creteForm(){
    return {}
  }

  @Post()
  @Redirect("/admin/users")
  async create(@Body() createUserDto: CreateUserDto){
    return {
      success: true
    }
  }
}